package com.gaoyubo.controller;

import com.gaoyubo.entity.User;
import com.gaoyubo.service.UserService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
public class UserController {
    @Autowired
    private UserService userService;
    @RequestMapping("zhuce")
    public boolean zhuce(@RequestBody User user){
        try {
            userService.zhuce(user);
            return true;
        }catch (Exception e){
            return false;
        }
    }
    @RequestMapping("logToList")
    public User logToList(User un){
        System.out.println(un.getUname());
        return userService.logToList(un);
    }
    @RequestMapping("list")
    public PageInfo<User> list(@RequestParam(defaultValue = "1") Integer pageNum,
                               @RequestParam(defaultValue = "3") Integer pageSize,
                               User u){
        System.out.println("9999999");
        System.out.println(u.getUname());
        return userService.list(pageNum,pageSize,u);
    }
}
